<template>
	<view class="tabs">
		<u-tabbar :value="value4" @change="name =>change(name)" :fixed="true" :placeholder="false"
			activeColor="#5406CD" :safeAreaInsetBottom="false" class="u-page">
			<u-tabbar-item  text="首页" @click='name=>swtab(name)'>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/newTab/1.png"></image>
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/newTab/2.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="消息" @click='name=>swtab(name)' :dot='isShow'>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/newTab/3.png"></image>
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/newTab/4.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="动态" @click='name=>swtab(name)'>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/newTab/5.png"></image>
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/newTab/6.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="订单" @click='name=>swtab(name)'>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/newTab/7.png"></image>
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/newTab/8.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="我的" @click='name=>swtab(name)'>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/newTab/9.png"></image>
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/newTab/10.png"></image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		props: ['value'],
		data() {
			return {
				value4: this.value,
				isShow:false,
			}
		},
		created() {
			uni.showLoading({title:'加载中'})
			this.$http.post('api/user/log/sysmessage', {
				page:1,limit:10
			}).then(res => {
				uni.hideLoading()
				uni.setStorageSync('msg',res[0].is_read)
			})
			let a = uni.getStorageSync('msg')
			if(a == false){
				this.isShow = true
			}
		},
		methods: {
			swtab(e) {
				this.value4 = e
				switch (e) {
					case 0:
						this.value4 = this.value
						uni.switchTab({
							url: '/pages/index/indexNew'
						})
						break;
					case 1:
						this.value4 = this.value
						uni.switchTab({
							url: '/pages/technician/Usermessage'
						})
						break;
					case 2:
						this.value4 = this.value
						uni.switchTab({
							url: '/pages/dynamic/dynamic'
						})
						break;
					case 3:
						this.value4 = this.value
						uni.switchTab({
							url: '/pages/order/order'
						})
						break;
					case 4:
						this.value4 = this.value
						uni.switchTab({
							url: '/pages/my/my'
						})
						break;
				}
			},
			change(e) {
				this.value4 = e
			},
		}
	}
</script>

<style>
	.u-page__item__slot-icon {
		width: 48rpx;
		height: 48rpx;
	}
	.u-tabbar-item{
		padding: 40rpx 0;
	}
	
	
</style>
